﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace Projektet.Model
{
    class Castle : CombatUnit
    {
        private EventListener _eventListener;

        public Castle(PlayerType playerType, EventListener eventListener, Vector2 startingPosition) 
        {
            _eventListener = eventListener;
            _playerType = playerType;

            _health = 15f;
            _width = 20;
            _height = 20;
            _unitPosition = new Vector2(startingPosition.X,startingPosition.Y);
            //Console.WriteLine(_playerType + " " + _unitPosition.X);
        }

        public override bool IsDead()
        {
            if (_health < 0)
            {
                if(_playerType == PlayerType.Npc)
                {
                    _eventListener.EventHandler(Event.PlayerVictory);
                }
                else
                {
                    _eventListener.EventHandler(Event.NpcVictory);
                }                
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
